www.gusucode.com > 落叶冰点万能企业网站内容管理系统 V9.1 > 落叶冰点万能企业网站内容管理系统 V9.1\code\inc\ND_mix_reg.asp

    <%


'**************************************************************
' 新动软网站管理系统
' 官方网站: http://www.aspcpu.com
' 系统作者: 阮丁远(网名:天下程序)
' Copyright 新动软网站管理系统 版权所有
'**************************************************************


%>

<%

'接口:
usddd=usddd
psddd=psddd
cook=cook ' j1 j30 j365
CookieDate=CookieDate '0 1 2 3

	Function getIP() 
		Dim strIPAddr 
		If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" Or InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "unknown") > 0 Then 
			strIPAddr = Request.ServerVariables("REMOTE_ADDR") 
		ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",") > 0 Then 
			strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",")-1)
			Actforip = Request.ServerVariables("REMOTE_ADDR")
		ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";") > 0 Then 
			strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";")-1)
			Actforip = Request.ServerVariables("REMOTE_ADDR")
		Else 
			strIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
			Actforip = Request.ServerVariables("REMOTE_ADDR")
		End If 
		getIP = Replace(Trim(Mid(strIPAddr, 1, 30)), "'", "")
	End Function





	'****************************************************
	'参数说明
	  'Subject     : 邮件标题
	  'Email       : 收件人邮件地址
	  'Content     : 邮件内容
      'is_for_qiye_mail   企业子系统不?
	'****************************************************
	
	is_for_qiye_mail=0
	  Public Function SendMailb(Subject, Email, Content)
	  '                        
	   On Error Resume Next
	   
	   SendMailb="not_suputted"
	   biao2="[ND_sys]"	   
	   if is_for_qiye_mail=1 then
	   biao2="[ND_sys]"
	   

set rs22t=server.CreateObject("adodb.recordset")
rs22t.open "select top 1 * from "&biao2&" where type='config_settings_qiye'",conn,1,1
else
set rs22t=server.CreateObject("adodb.recordset")
rs22t.open "select top 1 * from "&biao2&" where type='config_settings'",conn,1,1
end if

     ddd1tt=rs22t("data")
      dddd12tt=split(ddd1tt,"|")
	   SiteNamexx=cstr(trim(dddd12tt(2)&" "))
	   comtype=cstr(dddd12tt(7))
       if comtype="0" then
	   SendMailb ="not_suputted"
 exit function
 end if
 LoginName=cstr(trim(dddd12tt(10)&" "))
 LoginPass=cstr(trim(dddd12tt(11)&" ")) 
 MailAddress=cstr(trim(dddd12tt(9)&" ")) 
 Fromer=cstr(trim(dddd12tt(8)&" "))
	   
	if comtype="1" then
	
		  Set jmail = Server.CreateObject("JMAIL.Message") '建立发送邮件的对象
			jmail.silent = true '屏蔽例外错误,返回FALSE跟TRUE两值j
			jmail.Charset = "GB2312" '邮件的文字编码为国标
			jmail.ContentType = "text/html" '邮件的格式为HTML格式
			jmail.AddRecipient Email '邮件收件人的地址
			jmail.From = Fromer '发件人的E-MAIL地址
			jmail.FromName = SiteNamexx
			  If LoginName <> "" And LoginPass <> "" Then
				JMail.MailServerUserName = LoginName '您的邮件服务器登录名
				JMail.MailServerPassword = LoginPass '登录密码
			  End If
		If Err Then

SendMailb ="not_suputted"
 exit function
 end if
			jmail.Subject = Subject '邮件的标题 
			JMail.Body = Content
			JMail.Priority = 1'邮件的紧急程序,1 为最快,5 为最慢, 3 为默认值
			Flagaa=jmail.Send(MailAddress) '执行邮件发送(通过邮件服务器地址)
			jmail.Close() '关闭对象
		Set JMail = Nothing
		If Flagaa Then
			SendMailb = "OK"

		Else
			SendMailb = "False"
		End If
	  Exit function 
	  
	  end if



	if comtype="2" then
	Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
	objCDOMail.From = Fromer  '邮件地址
	objCDOMail.To = Email
	objCDOMail.Subject = Subject
	objCDOMail.BodyFormat = 0 
	objCDOMail.MailFormat = 0 
	objCDOMail.Body = Content
	If Err <> 0 Then
		SendMailb="not_suputted"
	Else
		objCDOMail.Send
		If Err <> 0 Then
			SendMailb="False"
		Else
			SendMailb="OK"
		End If
	End If
	Set objCDOMail = Nothing
exit function
end if


	if comtype="3" then

	Set Mailer=Server.CreateObject("Persits.MailSender") 
	Mailer.Charset = "gb2312"
	Mailer.IsHTML = True
	Mailer.username = LoginName	'服务器上有效的用户名
	Mailer.password = LoginPass	'服务器上有效的密码
	Mailer.Priority = 1
	'Mailer.Host = 
	Mailer.Host =MailAddress
	
	Mailer.Port = 25 ' 该项可选.端口25是默认值
	Mailer.From = Fromer   '邮件地址
	Mailer.FromName = SiteNamexx ' 该项可选
	Mailer.AddAddress Email,Email
	Mailer.Subject = Subject
	Mailer.Body = Content
	If Err <> 0 Then
		SendMailb="not_suputted"
	Else
		Mailer.Send
		If Err <> 0 Then
			SendMailb="False"
		Else
			SendMailb="OK"
		End If
	End If
	Set Mailer = Nothing
exit function

end if

	if comtype="CDO.Message" then

	If Not IsObject(cdoConfig) Then
	sch = "http://schemas.microsoft.com/cdo/configuration/"
	Set cdoConfig = Server.CreateObject("CDO.Configuration")
	With cdoConfig.Fields 
		.Item(sch & "smtpserver") = MailAddress		'--SMTP 服务器


		'.Item(sch & "smtpserverport") = 25
		.Item(sch & "sendusing") = 2
		.Item(sch & "smtpaccountname") = SiteNamexx
		.Item(sch & "sendemailaddress") = Fromer
		.Item(sch & "smtpuserreplyemailaddress") = 25
		'.Item(sch & "smtpauthenticate") = cdoBasic
		.Item(sch & "sendusername") = LoginName
		.Item(sch & "sendpassword") = LoginPass
		.update 
	End With
	If Err<>0 Then
		SendMailb="False"
		exit function
	End If


	End If
	

	Set Obj = Server.CreateObject("CDO.Message") 
	With Obj 
		Set .Configuration = cdoConfig 
		.To = Email
		.Subject = Subject
		.TextBody = Content
		.Send
	End With
	Set Obj = Nothing
	Set cdoConfig = Nothing
	If Err<>0 Then
		SendMailb="False"
	Else
		SendMailb="OK"
	End If
exit function

end if

end function



function IsValidEmail(email)

 dim names, name, i, c


 IsValidEmail = true
 names = Split(email, "@")
 if UBound(names) <> 1 then
   IsValidEmail = false
   exit function
 end if
 for each name in names
   if Len(name) <= 0 then
     IsValidEmail = false
     exit function
   end if
   for i = 1 to Len(name)
     c = Lcase(Mid(name, i, 1))
     if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
       IsValidEmail = false
       exit function
     end if
   next
   if Left(name, 1) = "." or Right(name, 1) = "." then
      IsValidEmail = false
      exit function
   end if
 next
 if InStr(names(1), ".") <= 0 then
   IsValidEmail = false
   exit function
 end if
 i = Len(names(1)) - InStrRev(names(1), ".")
 if i <> 2 and i <> 3 then
   IsValidEmail = false
   exit function
 end if
 if InStr(email, "..") > 0 then
   IsValidEmail = false
 end if

end function

function ubbg(str)
dim re
	Set re=new RegExp
	re.IgnoreCase=true
	re.Global=True

re.Pattern="(height|javascript|jscript:|js:|value|about:|file:|document.cookie|vbscript:|vbs:|script|width|)"
str=re.Replace(str,"")

re.Pattern="(on(mouse|exit|error|click|key))"
str=re.Replace(str,"")
re.Pattern="(&#)"
str=re.Replace(str,"&#")

set re=Nothing
ubbg=str
end function






biao2="[ND_sys]"

set rs22=server.CreateObject("adodb.recordset")
rs22.open "select top 1 * from "&biao2&" where type='config_settings'",conn,1,1

ddd1=rs22("data")
dddd12=split(ddd1,"|")
can_zhu=dddd12(12)
unreg=dddd12(20)
ddian=dddd12(17)
isneedshenhe=dddd12(13)
is_email_pwd=cstr(dddd12(14))
is_only_email=cstr(dddd12(15))
is_sendmail=cstr(dddd12(16))

goreg=true


'==========================start接口 ================================


if G_sys_type="blog"  then
name=Replace(Request.Form("username"),"'","''")
password=Replace(Request.Form("password"),"'","''")
repassword=Replace(Request.Form("repassword"),"'","''")
question=Replace(Request.Form("question"),"'","''")
answer=Replace(Request.Form("an"),"'","''")
mypic=Replace(Request.Form("mypic"),"'","''")


blogname=trim(request("blogname"))
usertype=clng(request("usertype"))


toupic=Replace(Request.Form("headpic"),"'","''")
email=Replace(Request.Form("email"),"'","''")

sex=Replace(Request.Form("sex"),"'","''")


end if







if G_sys_type="bbs"  then
width=100
height=100
name=Replace(Request.Form("name"),"'","''")
password=Replace(Request.Form("password"),"'","''")
repassword=Replace(Request.Form("repassword"),"'","''")
question=Replace(Request.Form("question"),"'","''")
answer=Replace(Request.Form("answer"),"'","''")
mypic=Replace(Request.Form("mypic"),"'","''")
mypic=ubbg(mypic)
toupic=Replace(Request.Form("headpic"),"'","''")
email=Replace(Request.Form("email"),"'","''")
home=Replace(Request.Form("home"),"'","''")
sex=Replace(Request.Form("sex"),"'","''")
burn=Replace(Request.Form("burn"),"'","''")
qq=Replace(Request.Form("qq"),"'","''")
gxqm=Request.Form("gxqm")
gxqm=Replace(left(gxqm,255),"'","''")
ch=Replace(Request.Form("ch"),"'","''")
ku=Replace(Request.Form("ku"),"'","''")
mytp=mypic
if mypic="" then
mytp="/bbs/headpic/"&toupic&".gif"
end if
ch=height
ku=width

if not isnumeric(ch) or not isnumeric(ku) then
mes=mes&"<br>你的图像大小设置错误!!<br>"
goreg=false%>
<%else%>
<%if ch>120 or ku>120 then
ch=height
ku=width
end if
end if



if trim(repassword)="" then

goreg=false
mes=mes&"请输入 确认密码!<br>"
end if

if trim(repassword)<>trim(password)  then

goreg=false
mes=mes&"密码两次输入不一致!<br>"
end if

end if





if G_sys_type="mcenter"  then
name=Replace(Request.Form("UserNamedd"),"'","''")
password=Replace(Request.Form("password"),"'","''")
repassword=Replace(Request.Form("password2"),"'","''")
question=Replace(Request.Form("tiwen"),"'","''")
answer=Replace(Request.Form("daan"),"'","''")

age=request.form("age")

dizhi=request.form("Address")


mypic=Replace(Request.Form("face"),"'","''")

toupic=Replace(Request.Form("headpic"),"'","''")
email=Replace(Request.Form("email"),"'","''")
home=Replace(Request.Form("home"),"'","''")
sex=Replace(Request.Form("sex"),"'","''")
burn=Replace(Request.Form("burn"),"'","''")
qq=Replace(Request.Form("qq"),"'","''")
gxqm=Request.Form("qianming")
gxqm=Replace(left(gxqm,655),"'","''")

mytp=mypic
if mypic="" then
mytp="/bbs/headpic/"&toupic&".gif"
end if
ch=height
ku=width

if trim(repassword)="" then

goreg=false
mes=mes&"请输入 确认密码!<br>"
end if

if trim(repassword)<>trim(password)  then

goreg=false
mes=mes&"密码两次输入不一致!<br>"
end if



end if




if G_sys_type="sys"  then



name=Replace(request("nam"),"'","''")
password=Replace(request("pwd"),"'","''")
repassword=Replace(Request.Form("pwd"),"'","''")



email=Replace(request("em"),"'","''")

sex=Replace(request("cc1"),"'","''")

qq=Replace(Request.Form("qq"),"'","''")







end if







'==========================end ================================




    If request("ccode") = "" Then
goreg=false 
mes=mes&"验证码不能为空!<br>"
    End If
    If Trim(Session("CheckCode")) = "" Then
goreg=false
mes=mes&"你登录时间过长,请重新返回登录页面进行登录。<br>"
    End If
    If request("ccode") <> Session("CheckCode") Then
goreg=false
mes=mes&"您输入的验证码和系统产生的不一致,请重新输入。<br>"
    End If











if trim(name)="" then

goreg=false
mes=mes&"请输入用户名!<br>"
end if
if trim(password)="" then

goreg=false
mes=mes&"请输入 密码!<br>"
end if


if qq<>"" and not isnumeric(qq) then
mes=mes&"<br>你的 QQ 填写错误!!<br>"
goreg=false
end if



	if trim(email)<>"" then
 if IsValidEmail(trim(email))<>true then
        goreg=false
        mes=mes&"email地址的格式有误!<br>"
		end if
		end if




cxsname=name
if trim(unreg)<>"" and trim(cxsname)<>"" then
unregt=split(trim(unreg),",")
for ithi=0 to ubound(unregt)
if instr(1,lcase(trim(cxsname)),lcase(unregt(ithi)),1)<>0 or instr(1,lcase(trim(cxsname)),"'",1)<>0 then
can=false
goreg=false
mes=mes&"用户名中含有非法字符或含禁止注册的字符!<br>"
exit for
end if

next
end if



cxsemail=email

if is_only_email="1" then


set rs2c2m=server.CreateObject("adodb.recordset")
rs2c2m.open "select * from [ND_user] where [email]='"&trim(cxsemail)&"'",conn,1,1

if not rs2c2m.eof then
      goreg=false
        mes=mes&"此email地址已被一个用户注册,请换一个email地址<br>"
end if
		
end if



	if is_email_pwd="0"  and trim(cxsemail)=""  then
      goreg=false
       mes=mes&"请输入email地址。<br>"
    End If	


if cstr(can_zhu)<>"1" then
goreg=false
mes=mes&"网站暂停了新用户注册,注册操作当前被禁止!<br>"

end if



usddd=""
dddad=0

if goreg=true then



passworda=md5(password)
answer=md5(answer)
set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from [nd_user] where [username]='"&name&"'"
rs.open sql,conn,1,3
if not rs.eof then
dddad=1

mes="<br>对不起!用户名:"&name&" 已被人注册了!!!<br>"

else





rs.addnew



	        if cstr(isneedshenhe)="1" then
		
		
		rs("user_stutas")="0"
		
		shshstrr=",您的帐户正在等待管理员审核,请等待"	
		else
		rs("user_stutas")="1"
	            shshstrr=""
                           end if





rs("username")=name




	if is_email_pwd="0" then
rs("pwd")=passworda
 else
 
 
Randomize '初始化随机数生成器。
rnddd = cstr(clng(Rnd(255)*99999))&cstr(clng(Rnd(255)*99999)) '产生随机数


If Request.ServerVariables("SERVER_PORT") = "80" Then
			GetSiteUrl = "http://" & Request.ServerVariables("server_name")
		Else
			GetSiteUrl = "http://" & Request.ServerVariables("server_name") & ":" & Request.ServerVariables("SERVER_PORT")
		End If
weerbnamb = GetSiteUrl


Email=trim(request("email"))
Subject="这是您的登陆密码,请注意查收(来自"&weerbnamb&")"
Content="您的登陆密码是"&rnddd&"  ,您注册的用户名是"&trim(name)&","&shshstrr&" (邮件来自"&weerbnamb&")"
restss=SendMailb(Subject, Email, Content)
if restss="not_suputted" then
dddad=1
mes=mes&"发送 您的登陆密码到您指定的邮箱时发生错误(原因:服务器不支持邮件发送组件或您未在基本设置里指定邮件发送组件),注册失败!<br>"
end if

if restss="OK" then
rs("pwd")=md5(rnddd)

end if
if restss="False" then
dddad=1
mes=mes&"发送您的登陆密码到您指定的邮箱时发生错误(原因:发送失败,可能您在基本设置里指定的邮件登陆用户名或密码是错误的),注册失败!<br>"

end if

 
 end if




		
if is_sendmail="1" and trim(request("email"))<>"" then
		
Email=trim(request("email"))
Subject="注册成功,用户名:"&trim(name)&" (来自"&weerbnamb&")"
Content="注册成功,您的登陆密码是"&password&"  ,您注册的用户名是"&trim(name)&","&shshstrr&" (邮件来自"&weerbnamb&")"
restss=SendMailb(Subject, Email, Content)
	
end if








'-----------------------for newd_sys


if trim(request("dian"))<>"" then
rs("dianshuo")=clng(request("dian"))
else
rs("dianshuo")=clng(ddiana)

end if


rs("denglu_count")="0"
rs("uesrclass")="0"

if request("group")="" then
rs("lever_id")=2
else
rs("lever_id")= request("group")
end if

rs("nick")=name

rs("pwd_wenti")=question
rs("pwd_daan_md5")=answer
rs("email")=email
rs("home")=home
rs("sex")=sex
rs("burn")=burn
rs("qq")=qq
'rs("toupic")=mytp

if trim(mytp)="" then

if request("faceb")="" then
rs("touxiang")="/images/touxiang/Image7.gif"
else
rs("touxiang")=request("faceb")
end if

else
rs("touxiang")=mytp
end if

if ch="" then ch=120
if ku="" then ku=120
rs("ch")=ch
rs("ku")=ku
if gxqm="" then gxqm=" "
rs("gxqm")=gxqm
rs("qian")=1000
rs("meili")=200
rs("jingyan")=200


rs("reg_ip")=getIP()


if request("fromweb")="" then

		If Request.ServerVariables("SERVER_PORT") = "80" Then
			GetSiteUrl = "http://" & Request.ServerVariables("server_name")
		Else
			GetSiteUrl = "http://" & Request.ServerVariables("server_name") & ":" & Request.ServerVariables("SERVER_PORT")
		End If

rs("fromwhatweb")=GetSiteUrl 
else

rs("fromwhatweb")=request("fromweb")

end if
rs("dizhi")=dizhi

rs("tel")=request.form("Tel") 


                rs("moneyd")=25
                rs("howmanysong")=0




'---------------------for blog

set rsdddd1=conn.execute("select reguserlevel,admincheckreg from bloginfo")
userlevel=rsdddd1("reguserlevel")
if rsdddd1("admincheckreg")="true" then
	userlevel=6
end if


set rsreg22=server.CreateObject("adodb.recordset")
rsreg22.open "select top 1 * from [userskin] where isdefault='true'",conn,1,1
if not rsreg22.eof then
sdfid=rsreg22("id")
sdfmain=rsreg22("skinmain")
sdflog=rsreg22("skinshowlog")
end if


if not rsreg22.eof then

		rs("defaultskin")=sdfid

		rs("userskinmain")=sdfmain

		rs("userskinshowlog")=sdflog

end if

                 rs("regtime")=now()


		rs("userlevel")=userlevel
		rs("userispass")=userispass
         if request("blogname")="" then
		rs("blogname")="请修改你的博客的名字"
else

		rs("blogname")=trim(request("blogname"))
end if

if request("usertype")="" then

    set rsassa=conn.execute("select id,typename from usertype")

		rs("usertypeid")=clng(rsassa(0))
else

		rs("usertypeid")=clng(request("usertype"))

end if






if dddad=0 then


rs.update
conn.execute("update [bbsinfo] set newuser='"&name&"',usernum=usernum+1")

conn.execute("update bloginfo set usercount=usercount+1")

Session("CheckCode")=""

usddd=name
psddd=password


end if




end if

end if


function showerr(str)
%>
<br><br>
<table cellspacing="0" cellpadding="1" width="430" align="center" border="1">
    <tbody>
        <tr>
            <td width="424" height="25" align="center" bgcolor="#9aaffa"><strong><font color="#FFFFFF">出错了!</font></strong></td>
        </tr>
        <tr>
            <td align="center" height="127">出错原因:<br />
            <%=str%>
			
			<br>
			<a href="javascript:history.go(-1)">返回</a>
			
			</td>
        </tr>
    </tbody>
</table><br><br>
<%
end function


if usddd<>"" then
%>



<!--#include file=ND_mix_login.asp-->



<%

end if


if usddd<>""  then
%>

<script language=javascript>

alert("注册成功,您注册的帐号是 一站通 的,本网站任何部分的功能如果要求登陆后再使用,您都可以用此帐号来登陆");

<%if globl_to_url<>"" then%>
self.location="<%=globl_to_url%>";
<%
end if
%>

</script>
<%
else
if  needshowerr=1 then
call showerr(mes)
end if
end if

if G_sys_type="bbs" and   needshowerr=0 and usddd="" then

mes=mes&""&"<a href='javascript:history.go(-1)'><font color=#0000ff>返回</font></a>"
end if
%>